package com.example.demo.config;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * 类名：RequestWrapperFilter.java
 * 路径：com.example.demo.config.RequestWrapperFilter.java
 * 创建人：tanyp
 * 创建时间：2019/12/10 15:37
 * 功能：创建HttpServletRequest包装类
 * 修改人：
 * 修改时间：
 * 修改备注：
 */
@Slf4j
public class RequestWrapperFilter implements Filter {

    @Override
    public void init(javax.servlet.FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        ServletRequest requestWrapper = new RequestWrapper((HttpServletRequest) request);
        chain.doFilter(requestWrapper, response);
    }

    @Override
    public void destroy() {
    }
}
